/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.softace.jdbc;

/**
 * The <code>IConnectionParameters</code> implementation for MySQL JDBC.
 * Override its abstract methods to return your own parameters.<br>Side note: In
 * order to avoid re-typing the same code, it is advised to keep a static object
 * of this class in its child class like this:
 * <pre><code>
 * public class MySqlJdbcConnectionParameters extends JdbcConnectionParameters {
 *
 *     public static JdbcConnectionParameters params = new MySqlJdbcConnectionParameters();
 *
 *     // overridden methods goes here
 * }
 * </code>
 * Then in the calling class:
 * <code>
 * public class Test extends JdbcUtility {
 *
 *      public Test() {
 *          super(MySqlJdbcConnectionParameters.params);
 *      }
 *
 *      // other methods and logic comes here
 * }
 * </code></pre><br>For more details, see the sample code
 *
 * @author S1LENT W@RRIOR
 * @version 1.0
 */
public abstract class JdbcConnectionParameters implements IConnectionParameters {

    /**
     * The Default Driver Name for MySQL JDBC
     */
    protected static final String DRIVER_NAME = "com.mysql.jdbc.Driver";
    /**
     * The Default Connection String for MySQL server deployed at localhost and
     * port 3306
     */
    protected static final String CONNECTION_STRING = "jdbc:mysql://127.0.0.1:3306/";

    /**
     * Gives the Database Driver name. In case of MySQL JDBC 5.x, this method
     * need not to be overridden.
     *
     * @return The Default MySQL JDBC Driver Name
     */
    @Override
    public String getDriverName() {
        return DRIVER_NAME;
    }

    /**
     * Gives the Connection String needed to connect to your Database. In case
     * if your database server is deployed <b>locally</b> at port <b>3306</b>,
     * this method need not to be overridden.
     *
     * @return The Default Connection String
     */
    @Override
    public String getConnectionString() {
        return CONNECTION_STRING;
    }

    /**
     * This abstract method needs to be overridden to return your database name
     *
     * @return The database name
     */
    @Override
    public abstract String getDatabaseName();

    /**
     * This abstract method needs to be overridden to return your MySQL username
     *
     * @return The user name
     */
    @Override
    public abstract String getUsername();

    /**
     * This abstract method needs to be overridden to give your MySQL password
     *
     * @return The password
     */
    @Override
    public abstract String getPassword();
}
